<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" media="screen" type="text/css" href="__THEMES__/style/layout.css" />
		<script type="text/javascript" src="__JS__/jQuery/jquery.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/troperate.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/alertbox.js"></script>
		<include file="Public:js_artDialog" />
		<script type="text/javascript">
			$(function(){
				$('#add_user').click(function(){
					art.dialog.loadCall("__URL__/add",{
						title : $(this).val(),
						lock : true
					}, false, function(){
						var ic = $('body',parent.document).find('#add_submit');
						ic.submit(function(){
							if ( ic.find('#account').val() == '' ){
								setAlertBox('账户名必须！', 2);
								ic.find('#account').addClass('errorInput').focus();
								return false;
							}
							$.post('__URL__/insert',ic.serialize(),function(c){
								setAlertBox(c.info, 2);
								if ( c.status === 0 ){
									return false;
								}else{
									window.location.reload();
								}
							},'json');
							return false;
						});
					});
				});
				
				$('.edit_user').click(function(){
					var url = $(this).attr('href');
					art.dialog.loadCall(url,{
						title : '编辑用户',
						lock : true
					}, false, function(){
						var ic = $('body',parent.document).find('#edit_submit');
						ic.submit(function(){
							if ( ic.find('#account').val() == '' ){
								setAlertBox('账户名必须！', 2);
								ic.find('#account').addClass('errorInput').focus();
								return false;
							}
							$.post('__URL__/update',ic.serialize(),function(c){
								setAlertBox(c.info, 2);
								if ( c.status === 0 ){
									return false;
								}else{
									window.location.reload();
								}
							},'json');
							return false;
						});
					});
					return false;
				});
			});
		</script>
	</head>
	<body>
		
		<include file="Public:position" />
		
		<div class="button">
            <input type="button" value="新增用户" class="submit" id="add_user" />
        </div>
        
        <div class="a_table">
	    	<form action="__URL__/delete" method="post" name="userlist">
			<table width="100%">
				<tr style="background: #f0f7ff; font-weight: bold;">
					<td width="60" align="center" class="left_text">编号</td>
					<td width="100" align="center" class="left_text">用户名</td>
					<td align="center" class="left_text">昵称</td>
					<td align="center" class="left_text">Email</td>
					<td align="center" class="left_text">添加时间</td>
					<td align="center" width="180" class="left_text">上次登录</td>
					<td align="center" class="left_text">登录次数</td>
					<td align="center" width="40" class="left_text">状态</td>
					<td align="center" width="100" class="left_text">操作</td>
				</tr>
				<volist id="vo" name="list">
				<tr rel="{$vo['id']}" class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
					<td align="center">{$vo['id']}</td>
					<td align="center">{$vo['account']}</td>
					<td align="center">{$vo['nickname']}</td>
					<td align="center">{$vo['email']}</td>
					<td align="center">{$vo['create_time']|date="Y-m-d",###}</td>
					<td align="center"><?php
						if ($vo['last_login_time'] == 0){
							echo '从未登录过';
						}else{
					?>{$vo['last_login_time']|date="Y-m-d H:i:s",###}<?php } ?></td>
					<td align="center">{$vo['login_count']}</td>
					<td align="center">{$vo['status']|getStatus}</td>
					<td align="center">{$vo['status']|showStatus=$vo['id']}<span class="action_line">&nbsp;&nbsp;|&nbsp;&nbsp;</span><a href="{:U('user/edit',array('id'=>$vo["id"]))}" class="edit_user">编辑</a></td>
				</tr>
				</volist>
			</table>
			</form>
        </div>
        <div class="page">{$page}</div>
	</body>
</html>